Dynammic models always involves derivatives (equations that express how things change from time step to time step or place to place )
Implement population growth as a derivative - a model of population change
# note that we include time here but we don't use it; we will need this later
source("../R/dexppop.R")
dexppop## function (time, P, r)
## {
## dexpop = r * P
## return(list(dexpop))
## }
## [[1]]
## [1] 0.2
## [[1]]
## [1] 0.2
# lets look at this for a range of initial populations
pops = seq(from=1, to=100)
tmp = pops %>% map(~dexppop( time=0,r=0.01, P=.x))
pchange = unlist(tmp)
pdyn = data.frame(pops, pchange)
ggplot(pdyn, aes(pops, pchange))+geom_point(col="green", size=1.5)What if we wanted to look at population in 20 years given an initial condition
Two options
explicit solution to differential equation is known; e.g. you can integrate both sides of the equation! Not always possible but lets look at a case where it is possible
must be solved by iteration; this is what we do when we can’t integrate both sides
## function (T, P0, r, K)
## {
## P = P0 * exp(r * T)
## if (P > K) {
## P = K
## }
## return(P)
## }
# gives population after any time given an initial population
# 20 rabbits, growth rate of 0.01 how many in 30 years
exppop(T=30, P0=20, r=0.01, K=1000)## [1] 26.99718
# if we want to see how population evolves over time - generate a time series by running our model for each point in time
initialrabbits = 20
years = seq(from=1, to=100, by=2)
Ptime = years %>% map_dbl(~exppop( P0=initialrabbits, r=0.01, K=1000, T=.x))
# keep track of what times we ran
Ptime = data.frame(P=Ptime, years=years)
ggplot(Ptime, aes(years,P))+geom_point()+labs(x="years",y="Rabbit Population")# try generating results for maximum and minimum possible r values to compare (guess at what you think)
max_r = 0.1
min_r = 0.01
K = 1000
tmp = years %>% map_dbl(~exppop(r=max_r, P0=initialrabbits, K=K, T=.x))
Ptime$Pmaxr = tmp
tmp = years %>% map_dbl(~exppop(r=min_r, P0=initialrabbits, K=K, T=.x))
Ptime$Pminr = tmp
head(Ptime)## P years Pmaxr Pminr
## 1 20.20100 1 22.10342 20.20100
## 2 20.60909 3 26.99718 20.60909
## 3 21.02542 5 32.97443 21.02542
## 4 21.45016 7 40.27505 21.45016
## 5 21.88349 9 49.19206 21.88349
## 6 22.32556 11 60.08332 22.32556
Ptimep = Ptime %>% gather(key="r",value="P",-years)
ggplot(Ptimep, aes(years,P, col=r))+geom_point()+labs(x="years",y="Rabbit Population")There are 3 peer reviewed articles (see attached files) that provide examples of using Sobol Sensitivity analysis in the context of environmental modeling
Choose 1 of these 3 articles - read with the goal of understanding how the paper used sensitivity analysis as part of their overall modeling objective. (For the assignment just pick one article but I encourage you to at least skim all 3 to become more familiar with the use of sobol in enviornmental modeling)
In places the articles are technical and may discuss processes that you may not be familiar with (note that the snow article also discusses calibration and the energy article also presents an another sensitivity method) - you can skim as needed - your goal is see how sobol sensitivity analysis is used
In a paragraph
cite the paper
1-2 sentences - describe the goal of the model application (20 pts)
2-3 sentences - summarize what the sobol indices tell you about the influence of parameters on process/mechanisms/response being modeled (40pts)
1-2 sentences - suggest one reason why we might care about parameter importance in this context (e.g what might be the implications of high sensitivity of a particular parameter) (40 pts)
Submit on Gauchospace as a pdf
Review the simpledynamic.Rmd on ESM232_examples